<%--
  Created by IntelliJ IDEA.
  User: 蔡岳衡
  Date: 2016/7/27
  Time: 16:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@include file="/commons/importCryptoJs.jsp" %>
<title>数据库连接信息</title>

<p>
<div class="row">
    <!-- 搜索条件部分begin -->
    <div class="research_content_col col-xs-12 col-sm-12">
        <form action="" id="dbSearchForm">
            <div class="form-group col-xs-12 col-sm-3 researchInput">
                <label class="col-xs-3 col-sm-4 col-lg-3 control-label">数据库名</label>
                <div class="col-xs-9 col-sm-8 col-lg-9 control-input">
                    <input class="form-control" placeholder="请输入数据库名..."
                           type="text" name="Q_p.dbName_like">
                </div>
            </div>
            <div class="form-group col-xs-12 col-sm-3 researchInput">
                <label class="col-xs-3 col-sm-4 col-lg-3 control-label">端口</label>
                <div class="col-xs-9 col-sm-8 col-lg-9 control-input">
                    <input class="form-control" placeholder="请输入端口..."
                           type="text" name="Q_p.port_=_int">
                </div>
            </div>
            <div class="form-group col-xs-6 col-sm-3 researchSelect">
                <label class="col-xs-3 col-sm-4 col-lg-3 control-label">状态</label>
                <div class="col-xs-9 col-sm-8 col-lg-9 control-select">
                    <select id="dbStatus" name="Q_p.status_=_short" class="select2" data-placeholder="请选择状态...">
                    </select>
                </div>
            </div>
            <div class="form-group col-xs-6 col-sm-3 researchSelect">
                <label class="col-xs-3 col-sm-4 col-lg-3 control-label">类型</label>
                <div class="col-xs-9 col-sm-8 col-lg-9 control-select">
                    <select id="dbType" name="Q_p.type_=_short" class="select2" data-placeholder="请选择类型...">
                    </select>
                </div>
            </div>
            <div class="form-group col-xs-6 col-sm-3 researchSelect">
                <label class="col-xs-3 col-sm-4 col-lg-3 control-label">编码</label>
                <div class="col-xs-9 col-sm-8 col-lg-9 control-select">
                    <select id="dbCharset" name="Q_p.charset_=_short" class="select2" data-placeholder="请选择编码...">
                    </select>
                </div>
            </div>
        </form>
    </div>
    <!-- 搜索条件部分end -->
</div>
</p>
<div class="row">
    <div class="col-xs-12">
        <div class="row">
            <!-- 搜索按钮部分begin -->
            <div class="col-xs-12 col-sm-12">
                <button type="button" class="btn btn-success btn-sm"
                        onclick="dbConnInfo.searchDbConnInfo(false)">
                    <span class="glyphicon glyphicon-search"></span>&nbsp;&nbsp;搜索
                </button>
                <button type="button" class="btn btn-primary btn-sm"
                        onclick="dbConnInfo.openWinAddOrEditDbConnInfo(true)">
                    <span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;新增
                </button>
                <button type="button" class="btn btn-warning btn-sm"
                        onclick="dbConnInfo.openWinAddOrEditDbConnInfo(false)">
                    <span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;修改
                </button>
                <button type="button" class="btn btn-danger btn-sm" onclick="dbConnInfo.delDbConnInfo()">
                    <span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;删除
                </button>
                <button type="button" class="btn btn-info btn-sm"
                        onclick="dbConnInfo.clearDbConnInfoSearchForm();">
                    <span class="glyphicon glyphicon-remove"></span>&nbsp;&nbsp;清空查询
                </button>
                <button class="btn btn-purple btn-sm" onclick="dbConnInfo.openWinModifyPassword();">
                    <span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;修改密码
                </button>
            </div>
            <!-- 搜索按钮部分end -->
        </div>
        <p>
        <div class="row">
            <div class="col-xs-12 col-sm-12" style="overflow: hidden;">
                <table id="dbInfoJqgridTable"></table>
                <div id="dbInfoJqgridPager" style="height: 45px;"></div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="row">
                    <div class="col-xs-12 col-sm-12">
                        <p>
                            <!-- #section:elements.tab -->
                        <ul class="nav nav-tabs" id="myTab">
                            <li class="active">
                                <a data-toggle="tab" href="#home">
                                    <i class="green ace-icon fa fa-home bigger-120"></i>
                                    用户
                                </a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div id="project" class="tab-pane fade in active row">
                                <div class="row">
                                    <div class="col-xs-12 col-sm-12">
                                        <button type="button" class="btn btn-primary btn-sm"
                                                onclick="dbConnInfo.openWinAddRelAccount();">
                                            <span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;新增
                                        </button>
                                        <button type="button" class="btn btn-danger btn-sm"
                                                onclick="dbConnInfo.delDbRelAccount();">
                                            <span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;删除
                                        </button>
                                    </div>
                                </div>
                                <p>
                                <div class="row">
                                    <div class="col-xs-12 col-sm-12" style="overflow: hidden;">
                                        <table id="accReDbJqgridTable"></table>
                                        <div id="accReDbJqPagerTable" style="height: 45px"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.row -->
                </div>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div>
</div>

<!-- 数据库连接信息-新增弹窗begin -->
<div class="modal-content" id="dbAddOrEditModal" style="display: none; padding: 10px;">
    <form id="dbAddOrEditModelForm" action="">
        <table class="sun-form-table">
            <tr>
                <td><input type="text" name="id" class="sun-form-input form-control hide"/></td>
                <td><input type="text" name="createAccountId" class="sun-form-input form-control hide"/></td>
                <td><input type="text" name="createTime" class="sun-form-input form-control hide"/></td>
                <td><input type="text" name="modifyTime" class="sun-form-input form-control hide"/></td>
            </tr>
            <tr>
                <th>连接名</th>
                <td><input type="text" name="name" class="sun-form-input form-control" id="name"
                           required="required"/></td>
                <th>数据库名</th>
                <td><input type="text" name="dbName" class="sun-form-input form-control" id="dbName"
                           required="required"/></td>
            </tr>
            <tr>
                <th>端口</th>
                <td><input type="text" name="port" class="sun-form-input form-control" id="port" required="required"
                           range="[1, 32767]" digits="true"/></td>
                <th>ip地址</th>
                <td><input type="text" name="ip" class="sun-form-input form-control" id="ip"
                           required="required"/></td>
            </tr>
            <tr>
                <th>编码</th>
                <td>
                    <select name="charset" class="select2 form-control sun-form-select" id="addOrEditCharset"
                            required="required"
                            style="padding-top: 0px;">
                    </select>
                </td>
                <th>类型</th>
                <td>
                    <select name="type" class="select2 form-control sun-form-select" id="addOrEditType"
                            required="required"
                            style="padding-top: 0px;">
                    </select>
                </td>
            </tr>
            <tr id="editNeedHide">
                <th>用户名</th>
                <td><input type="text" name="username" class="sun-form-input form-control" id="username"
                           required="required"/></td>
                <th> 密码</th>
                <td><input type="password" name="password" class="sun-form-input form-control" id="password"
                           required="required"/></td>
            </tr>
            <tr>
                <th>状态</th>
                <td>
                    <select name="status" class="select2 form-control sun-form-select" id="addOrEditStatus"
                            required="required"
                            style="padding-top: 0px;">
                    </select>
                </td>
            </tr>
            <tr>
                <th>url</th>
                <td colspan="4"><textarea rows="2" cols="1" name="url" class="sun-form-input form-control"
                                          id="dbUrl"></textarea></td>
            </tr>
            <tr>
                <th> 描述</th>
                <td colspan="4"><textarea rows="2" cols="1" name="remark" class="sun-form-input form-control"
                                          id="remark"></textarea></td>
            </tr>
        </table>
    </form>
</div>
<!-- 数据库连接信息-新增弹窗end -->

<!-- 修改密码弹窗begin -->
<div class="modal-content" id="motifyPasswordModal" style="display: none;">
    <div style="margin: 10px 0px;text-align: center">
        <form id="motifyPasswordForm" action="">
            <label>设置新密码</label>

            <input type="password" name="newPassword" id="newPassword" required="required">

            <label>确认新密码</label>

            <input type="password" name="confirmPassword" id="confirmPassword" required="required">
        </form>
    </div>
</div>
<!-- 修改密码弹窗end -->

<!-- 用户管理-新增弹窗begin -->
<div class="modal-content" id="accAddModal" style="display: none;overflow-x: hidden">
    <div class="container" style="margin-top: 10px">
        <div class="row">
            <div class="col-sm-3 col-md-3">
                <div style="font-weight: bold">选中用户</div>
                <div style="margin-top: 25px;">
                    <button id="saveDbRelAccBtn" type="button" class="btn btn-info btn-sm">
                        <span class="glyphicon glyphicon-ok"></span>&nbsp;&nbsp;保存
                    </button>
                    <button type="button" class="btn btn-danger btn-sm" onclick="dbConnInfo.removeAddedAccount()">
                        <span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;移除
                    </button>
                    <button id="removeDbRelAccBtn" type="button" class="btn btn-warning btn-sm" onclick="">
                        <span class="glyphicon glyphicon-remove"></span>&nbsp;&nbsp;取消
                    </button>
                </div>
                <div class="col-sm-12" style="margin-top:10px; margin-bottom:10px;width: 270px;padding-left: 0px;">
                    <select class="form-control" id="accAddedJqgridTable" name="accAddedJqgridTable" multiple="multiple"
                            style="height:330px">
                    </select>
                </div>
            </div>
            <div class="col-sm-9 col-md-9" style="border-left:1px solid #f0f6e4;">
                <form class="form-horizontal" id="accAddTableForm" role="form">
                    <div class="form-group col-xs-6 col-sm-4 col-md-4">
                        <label class="col-sm-4 col-md-4  control-label" for="form-field-2"
                               style="font-size:13px;text-align: center;padding: 0;padding-right: 5px;overflow: hidden;font-weight: bold">中文名
                        </label>

                        <div class="col-sm-8 col-md-8 " style="padding: 0px">
                            <input name="Q_nameCn_like" id="form-field-2" class="form-control" type="text">
                        </div>
                    </div>
                    <div class="form-group col-xs-6 col-sm-4 col-md-4">
                        <label class="col-sm-4 col-md-4  control-label" for="form-field-3"
                               style="font-size:13px;text-align: center;padding: 0;padding-right: 5px;overflow: hidden;font-weight: bold">手机号码
                        </label>

                        <div class="col-sm-8 col-md-8 " style="padding: 0px">
                            <input name="Q_cellPhone_rightLike" id="form-field-3" class="form-control" type="text">
                        </div>
                        <div class="col-xs-6 col-sm-3 hide">
                            <input id="userDelStatus" value="0" type="text" name="Q_delStatus_=_Short">
                        </div>
                    </div>
                </form>
                <div class="col-sm-12" style="margin-top: 10px">
                    <button type="button" class="btn btn-success btn-sm" onclick="dbConnInfo.searchAccountInfo();">
                        <span class="glyphicon glyphicon-search"></span>&nbsp;&nbsp;查询
                    </button>
                    <button type="button" class="btn btn-primary btn-sm"
                            onclick="dbConnInfo.addAccount();">
                        <span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;添加
                    </button>
                    <button type="button" class="btn btn-info btn-sm" onclick="dbConnInfo.clearAccountSearchForm();">
                        <span class="glyphicon glyphicon-remove"></span>&nbsp;&nbsp;清空查询
                    </button>
                </div>

                <div class="col-sm-12" style="margin-top:10px; margin-bottom:10px; width: 785px;">
                    <table id="accAddJqgridTable"></table>
                    <div id="accAddJqgridPager" style="height:45px;"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 用户管理-新增弹窗end -->


<script type="text/javascript">

    var scripts = [
        null,
        path + '/admin/powerdb/designer/dbConnInfo/js/dbConnInfo.js',
        null
    ];

    $('.page-content-area').ace_ajax('loadScripts', scripts, function () {
        $(document).ready(function () {
            dbConnInfo.init();
        });
    });
</script>
